﻿namespace NumeralSystems
{
    using System;
    using System.Collections.Generic;

    class ConvertRandomDecToHex
    {
        // 1.1.8.06. Write a program that converts a decimal number to hexadecimal one.

        public static string ConvertDecimalToHexadecimal(int decimalNum)
        {
            List<char> hexadecimalCompilation = new List<char>();
            while (decimalNum != 0)
            {
                int digitEquivalent = decimalNum % 16;
                switch (digitEquivalent)
                {
                    case 0: hexadecimalCompilation.Add('0'); break;
                    case 1: hexadecimalCompilation.Add('1'); break;
                    case 2: hexadecimalCompilation.Add('2'); break;
                    case 3: hexadecimalCompilation.Add('3'); break;
                    case 4: hexadecimalCompilation.Add('4'); break;
                    case 5: hexadecimalCompilation.Add('5'); break;
                    case 6: hexadecimalCompilation.Add('6'); break;
                    case 7: hexadecimalCompilation.Add('7'); break;
                    case 8: hexadecimalCompilation.Add('8'); break;
                    case 9: hexadecimalCompilation.Add('9'); break;
                    case 10: hexadecimalCompilation.Add('A'); break;
                    case 11: hexadecimalCompilation.Add('B'); break;
                    case 12: hexadecimalCompilation.Add('C'); break;
                    case 13: hexadecimalCompilation.Add('D'); break;
                    case 14: hexadecimalCompilation.Add('E'); break;
                    case 15: hexadecimalCompilation.Add('F'); break;
                    default: throw new Exception("Error!"); break;  // never used exception before :D
                }

                decimalNum /= 16;
            }

            hexadecimalCompilation.Reverse();

            return String.Join("", hexadecimalCompilation);
        }

        static void Main()
        {
            int num = int.Parse(Console.ReadLine());
            Console.WriteLine(ConvertDecimalToHexadecimal(num));
        }
    }
}